#define _CRT_SECURE_NO_WARNINGS
class MyQueue {
private:
    stack<int> s1;
    stack<int> s2;
public:
    MyQueue() {
    }
    void push(int x) {
        stack<int> empty_stack = s1, noempty_stack = s2;
        if (!s1.empty()) {
            empty_stack = s2;
            noempty_stack = s1;
        }
        while (!noempty_stack.empty())
        {
            empty_stack.push(noempty_stack.top());
            noempty_stack.pop();
        }
        empty_stack.push(x);
        while (!empty_stack.empty())
        {
            noempty_stack.push(empty_stack.top());
            empty_stack.pop();
        }
        s1 = empty_stack;
        s2 = noempty_stack;
    }

    int pop() {
        stack<int> empty_stack = s1, noempty_stack = s2;
        if (!s1.empty()) {
            empty_stack = s2;
            noempty_stack = s1;
        }
        int top = noempty_stack.top();
        noempty_stack.pop();
        s1 = empty_stack;
        s2 = noempty_stack;
        return top;
    }

    int peek() {
        stack<int> empty_stack = s1, noempty_stack = s2;
        if (!s1.empty()) {
            empty_stack = s2;
            noempty_stack = s1;
        }
        return noempty_stack.top();
    }

    bool empty() {
        return s1.empty() && s2.empty();
    }
};

/**
 * Your MyQueue object will be instantiated and called as such:
 * MyQueue* obj = new MyQueue();
 * obj->push(x);
 * int param_2 = obj->pop();
 * int param_3 = obj->peek();
 * bool param_4 = obj->empty();
 */